import {
    CORE_APP_ADD,
    CORE_APP_CONFIG_DETAIL,
    CORE_APP_CONFIG_DETAIL_UNLOGIN,
    CORE_APP_CONFIG_UPDATE,
    CORE_APP_DELETE,
    CORE_APP_DETAIL,
    CORE_APP_LIST,
    CORE_APP_UPDATE
} from '@/config/api'
import {
    ICoreApp,
    ICoreAppDeleteParameter,
    ICoreAppEditParameter,
    ICoreAppDetailParameter,
    ICoreAppConfigDetailParameter,
    ICoreAppConfig
} from '@/types/core/app'
import http from '@/utils/http'

export function coreAppList() {
    return http.get<ICoreApp[]>(CORE_APP_LIST)
}

export function coreAppAdd(parameter: ICoreAppEditParameter) {
    return http.post(CORE_APP_ADD, parameter)
}

export function coreAppUpdate(parameter: ICoreAppEditParameter) {
    return http.post(CORE_APP_UPDATE, parameter)
}

export function coreAppDelete(parameter: ICoreAppDeleteParameter) {
    return http.post(CORE_APP_DELETE, parameter)
}

export function coreAppDetail(parameter: ICoreAppDetailParameter) {
    return http.get<ICoreApp>(CORE_APP_DETAIL, parameter)
}

export function coreAppConfigDetailUnlogin(
    parameter: ICoreAppConfigDetailParameter
) {
    return http.get<ICoreAppConfig>(CORE_APP_CONFIG_DETAIL_UNLOGIN, parameter)
}

export function coreAppConfigDetail(parameter: ICoreAppConfigDetailParameter) {
    return http.get<ICoreAppConfig>(CORE_APP_CONFIG_DETAIL, parameter)
}

export function coreAppConfigUpdate(parameter: ICoreAppConfig) {
    return http.post(CORE_APP_CONFIG_UPDATE, parameter)
}
